<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

</head>
<body>
    <a href="#/login">登陆</a>
    <a href="#/log">日志</a>
    <script>
        // const route=[
        //     {path:'/login',component:Login},
        //     {path:'/log',component:Log}
        // ]

        window.addEventListener('hashchange',()=>{
            console.log('锚点发生变化了',window.location);
            switch(window.location.hash.substring(1)){
                case "/login":
                    console.log('展示login');
                    break;
                case "/log":
                    console.log('展示log');
                    break;
            }
            
        })
    </script>
</body>
</html>